#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
void print(int arr[], int sz) {
	int i = 0;
	for (i = 0; i < sz; i++) {
		printf("%d ", arr[i]);
	}
}
int cam(const void* a, const void* b) {
	return *(int*)a - *(int*)b;
}
void swap(char*a,char*b,size_t ret) {
	int i = 0; 
	char tem = 0;
	for (i = 0; i < ret; i++) {
		tem = *a;
		*a = *b;
		*b = tem;
		a++;
		b++;
	}

}
void bubble_sort(void* base, size_t sz, size_t wdeph, int (*ret)(const void* a, const void* b)) {
	int i = 0;
	for (i = 0; i < sz - 1; i++) {
		int j = 0;
		for (j = 0; j < sz - i - 1; j++) {
			if (ret((char*)base + j * wdeph, (char*)base + (j+1) * wdeph)>0) {
				swap((char*)base + j * wdeph, (char*)base + (j + 1) * wdeph,wdeph);
			}
		}
	}


}
int main() {
	int arr[10] = { 7,4,1,8,5,2,0,9,6,3 };
	int sz = sizeof(arr) / sizeof(arr[0]);
	bubble_sort(arr,sz,sizeof(arr[0]),cam);

	print(arr, sz);
	return 0;
}